package cim.zihan.demo;

import java.io.IOException;
import java.net.ServerSocket;

/**
 * Created by dwlijx on 2021/5/4.
 * connect to lijx@zjhcsoft.com
 */
public class Server {
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(8000);
            System.out.println(serverSocket.getSoTimeout());//获取默认阻塞时间设置
            serverSocket.setSoTimeout(4000);
            System.out.println(serverSocket.getSoTimeout());
            System.out.println();
            System.out.println("begin:"+System.currentTimeMillis());
            serverSocket.accept();
            System.out.println("end:"+System.currentTimeMillis());
        }catch (IOException e) {
            e.printStackTrace();
            System.out.println("catch"+System.currentTimeMillis());
        }

    }
}
